export enum ResultCode {
  SUCCESS = '1',
  LOGIN_ERROR = '103',
  TOKEN_ERROR = '105',
  TOKEN_EXPIRED = '106',
  FAIL = '0',
  OTHER_ERROR = '109',
  MISSING_PARAMETER = '3',
  MISSING_TOKEN = '104',
  USER_EXIST = '107',
  USER_NOT_EXIST = '108',
  FILE_UPLOAD_ERROR = '110',
  FILE_TYPE_ERROR = '111',
  PARAMS_ERROR = '112',
  EMAIL_EXIST = '113',
  PRODUCT_CATEGORY_EXIST = '114',
  PRODUCT_CATEGORY_OPTIONAL_CONFIG_REPEAT = '115',
}

export const ResultCodeMessages: { [key in ResultCode]: string } = {
  [ResultCode.SUCCESS]: '成功',
  [ResultCode.TOKEN_ERROR]: '无效token',
  [ResultCode.TOKEN_EXPIRED]: 'token过期',
  [ResultCode.FAIL]: '操作失败',
  [ResultCode.LOGIN_ERROR]: '账号不存在或密码错误',
  [ResultCode.OTHER_ERROR]: '其他错误',
  [ResultCode.MISSING_PARAMETER]: '缺少参数',
  [ResultCode.MISSING_TOKEN]: '缺少token',
  [ResultCode.USER_EXIST]: '用户已存在',
  [ResultCode.USER_NOT_EXIST]: '用户不存在',
  [ResultCode.FILE_UPLOAD_ERROR]: '文件上传失败',
  [ResultCode.FILE_TYPE_ERROR]: '文件类型错误',
  [ResultCode.PARAMS_ERROR]: '参数错误',
  [ResultCode.EMAIL_EXIST]: '邮箱已存在',
  [ResultCode.PRODUCT_CATEGORY_EXIST]: '商品分类已存在',
  [ResultCode.PRODUCT_CATEGORY_OPTIONAL_CONFIG_REPEAT]: '商品分类可选配置名称重复',
};